package com.classroom;

public class MatchesDemo {
    public static void main(String[] args) {
        String email = "95312@163.com";
        String regex="\\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\\.[A-Z|a-z]{2,}\\b";

        /**
         * matches(String regex)
         * 告诉这个字符串是否匹配给定 regular expression。
         */
        boolean matches = email.matches(regex);
        System.out.println("matches = " + matches);
    }
}
